import req from '../utils/request';
import { LOGIN, USER_INFO } from '../constants/api';

export const login = (params) => {
    return req({
        url: LOGIN,
        method: 'post',
        data: params,
    })
        .then((res) => localStorage.setItem('Vue2_HR_ACCESS_TOKEN', `Bearer ${res.data.data}`))
        .catch((err) => Promise.reject(err.response.data.message));
}

export const getUserInfo = () => {
    return req({
        url: USER_INFO,
        method: 'POST',
    })

}
